﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SaveAWatt.Console
{
    public class CmdPrompt
    {
        private static CmdPrompt instance;

        public static CmdPrompt Instance
        {
            get { return instance; }
            set { instance = value; }
        }

        public void Output(string text)
        {
            System.Console.WriteLine(text);
        }

        public void Prompt()
        {
            string line = ReadLine("Console# ", true, true);

            if (line != String.Empty)
                Output("Invalid Command");
        }

        public string ReadLine(string p, bool isCommand, bool e)
        {
            System.Console.Write("{0}", p);
            string cmdinput = System.Console.ReadLine();

            if (isCommand)
            {
                //code to make sure it is a registered command
                if (cmdinput.Length <= 0)
                {
                    return String.Empty;
                }
            }
            return cmdinput;
        }
    }
}
